package com.rt.gptnext.common.utils.http;

/**
 * http请求成功校验器
 *
 * @author gaoyiyang
 */
@FunctionalInterface
public interface HttpSuccessValidator {

    /** 默认校验器 */
    HttpSuccessValidator DEFAULT = response -> {
        if (response == null) {
            return false;
        }
        return response.isOk();
    };

    /**
     * 校验请求是否成功
     *
     * @param response 请求响应
     * @return true|false
     */
    boolean valid(HttpResponse<byte[]> response);

}
